<template>
  <!-- 预览人员信息 -->
  <el-dialog :visible.sync="open" width="800px" append-to-body>
    <el-descriptions title="客户信息" :column="2" border>
      <el-descriptions-item label="头像">
        <el-avatar size="24" :src="user.userImage"></el-avatar>
      </el-descriptions-item>
      <el-descriptions-item label="用户昵称">{{user.nickName}}</el-descriptions-item>
      <el-descriptions-item label="归属部门">{{user.deptId || '平台客户'}}</el-descriptions-item>
      <el-descriptions-item label="手机号码">{{user.phonenumber}}</el-descriptions-item>
      <el-descriptions-item label="邮箱">{{user.email}}</el-descriptions-item>
      <el-descriptions-item label="用户名称">{{user.userName}}</el-descriptions-item>
<!--      <el-descriptions-item label="用户密码">{{user.password}}</el-descriptions-item>-->
      <el-descriptions-item label="用户性别">{{user.sex == 0 ? '男' : '女'}}</el-descriptions-item>
<!--      <el-descriptions-item label="用户角色">{{user.roleIds}}</el-descriptions-item>-->
      <el-descriptions-item label="备注">{{user.remark}}</el-descriptions-item>
      <el-descriptions-item label="省份">{{user.province}}</el-descriptions-item>
      <el-descriptions-item label="城市">{{user.city}}</el-descriptions-item>
      <el-descriptions-item label="联系地址">{{user.usetAddress || '无'}}</el-descriptions-item>
      <el-descriptions-item label="经纬度">{{user.latitude}}，{{user.longitude}}</el-descriptions-item>
    </el-descriptions>
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancel" type="primary">知道了</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { getUser, getUserInfo } from "@/api/system/user";

export default {
  name: "PreviewStaff",
  dicts: ['sys_normal_disable', 'sys_user_sex'],
  // props: ['userInfo'],
  data() {
    return {
      user: {},
      open: false,
    };
  },
  // props: {
  //   userInfo: {
  //     type: Object,
  //     default: {}
  //   },
  // },
  watch: {
  },
  created() {
  },
  methods: {
    showOpen() {
      this.open = true
      this.getUserInfo();
    },
    // 取消按钮
    cancel() {
      this.open = false;
    },
    /** 查询人员信息 */
    getUserInfo() {
      this.user = this.$parent.clickUser
      const userId = this.user.userId
      getUser(userId).then(response => {
        this.user = response.data.user;
        getUserInfo({ userId }).then(res=> {
          if (res.resultCode == 200) {
            this.user = Object.assign(this.user, res.data)
          }
        })
      });
    },
  }
};
</script>
